home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / M / MacPerl 4.13 tool.sit / Perl Tool ƒ / lib / macftp.pl < prev    next >
MacBinary  |  1993-10-23  |  10.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: macftp.pl

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Claris Works palette files (other/clarisWorksPaletteFiles) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sat Oct 23 01:19:02 1993, modified Sat Oct 23 01:19:02 1993, creator 'MPS ', type ASCII, 9906 bytes "macftp.pl" Perl script text executable default (weak)
99% file a /usr/local/bin/perl script executable (binary data), at 0x2732 428 bytes resource Perl script text executable default (weak)
98% file a /usr/local/bin/perl script executable (binary data) default (weak)
97% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 6d 61 63 66 74 70 | 2e 70 6c 00 00 00 00 00 |..macftp|.pl.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 26 b2 00 | 00 01 ac a8 ee 6f 46 a8 |.....&..|.....oF.|
|00000060| ee 6f 46 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.oF.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b2 a6 00 00 |........|........|
|00000080| 23 21 2f 75 73 72 2f 6c | 6f 63 61 6c 2f 62 69 6e |#!/usr/l|ocal/bin|
|00000090| 2f 70 65 72 6c 0d 23 20 | 20 20 54 68 69 73 20 69 |/perl.# | This i|
|000000a0| 73 20 61 20 73 65 74 20 | 6f 66 20 66 74 70 20 6c |s a set |of ftp l|
|000000b0| 69 62 72 61 72 79 20 72 | 6f 75 74 69 6e 65 73 20 |ibrary r|outines |
|000000c0| 75 73 69 6e 67 20 63 68 | 61 74 32 2e 70 6c 0d 23 |using ch|at2.pl.#|
|000000d0| 20 0d 23 20 20 20 52 65 | 74 75 72 6e 20 63 6f 64 | .# Re|turn cod|
|000000e0| 65 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 74 61 |e inform|ation ta|
|000000f0| 6b 65 6e 20 66 72 6f 6d | 20 52 46 43 20 39 35 39 |ken from| RFC 959|
|00000100| 0d 0d 23 20 20 20 57 72 | 69 74 74 65 6e 20 62 79 |..# Wr|itten by|
|00000110| 20 47 65 6e 65 20 53 70 | 61 66 66 6f 72 64 20 20 | Gene Sp|afford |
|00000120| 3c 73 70 61 66 40 63 73 | 2e 70 75 72 64 75 65 2e |<spaf@cs|.purdue.|
|00000130| 65 64 75 3e 0d 23 20 20 | 20 20 20 20 20 4c 61 73 |edu>.# | Las|
|00000140| 74 20 75 70 64 61 74 65 | 3a 20 31 30 20 41 70 72 |t update|: 10 Apr|
|00000150| 69 6c 20 39 32 2c 20 20 | 20 56 65 72 73 69 6f 6e |il 92, | Version|
|00000160| 20 30 2e 39 0d 23 0d 0d | 23 20 70 75 74 28 29 20 | 0.9.#..|# put() |
|00000170| 61 6e 64 20 70 6f 72 74 | 20 74 6f 20 4d 61 63 50 |and port| to MacP|
|00000180| 65 72 6c 20 4d 2e 20 4e | 65 65 72 61 63 68 65 72 |erl M. N|eeracher|
|00000190| 20 3c 6e 65 65 72 69 40 | 69 69 73 2e 65 74 68 7a | <neeri@|iis.ethz|
|000001a0| 2e 63 68 3e 0d 0d 23 0d | 23 20 20 20 4d 6f 73 74 |.ch>..#.|# Most|
|000001b0| 20 6f 66 20 74 68 65 73 | 65 20 72 6f 75 74 69 6e | of thes|e routin|
|000001c0| 65 73 20 63 6f 6d 6d 75 | 6e 69 63 61 74 65 20 6f |es commu|nicate o|
|000001d0| 76 65 72 20 61 6e 20 6f | 70 65 6e 20 66 74 70 20 |ver an o|pen ftp |
|000001e0| 63 68 61 6e 6e 65 6c 0d | 23 20 20 20 54 68 65 20 |channel.|# The |
|000001f0| 63 68 61 6e 6e 65 6c 20 | 69 73 20 6f 70 65 6e 65 |channel |is opene|
|00000200| 64 20 77 69 74 68 20 74 | 68 65 20 22 66 74 70 27 |d with t|he "ftp'|
|00000210| 6f 70 65 6e 22 20 63 61 | 6c 6c 2e 0d 23 0d 0d 70 |open" ca|ll..#..p|
|00000220| 61 63 6b 61 67 65 20 66 | 74 70 3b 0d 72 65 71 75 |ackage f|tp;.requ|
|00000230| 69 72 65 20 22 6d 61 63 | 63 68 61 74 2e 70 6c 22 |ire "mac|chat.pl"|
|00000240| 3b 0d 72 65 71 75 69 72 | 65 20 22 47 55 53 49 2e |;.requir|e "GUSI.|
|00000250| 70 68 22 3b 0d 0d 23 23 | 23 23 23 23 23 23 23 23 |ph";..##|########|
|00000260| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000270| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000280| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000290| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000002a0| 23 0d 23 0d 23 20 20 54 | 68 65 20 66 6f 6c 6c 6f |#.#.# T|he follo|
|000002b0| 77 69 6e 67 20 61 72 65 | 20 74 68 65 20 76 61 72 |wing are| the var|
|000002c0| 69 61 62 6c 65 73 20 6c | 6f 63 61 6c 20 74 6f 20 |iables l|ocal to |
|000002d0| 74 68 69 73 20 70 61 63 | 6b 61 67 65 2e 0d 23 20 |this pac|kage..# |
|000002e0| 20 49 20 64 65 63 6c 61 | 72 65 20 74 68 65 6d 20 | I decla|re them |
|000002f0| 61 6c 6c 20 75 70 20 66 | 72 6f 6e 74 20 73 6f 20 |all up f|ront so |
|00000300| 49 20 63 61 6e 20 72 65 | 6d 65 6d 62 65 72 20 77 |I can re|member w|
|00000310| 68 61 74 20 49 20 63 61 | 6c 6c 65 64 20 27 65 6d |hat I ca|lled 'em|
|00000320| 2e 20 3a 2d 29 0d 23 0d | 23 23 23 23 23 23 23 23 |. :-).#.|########|
|00000330| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000340| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000350| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000360| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000370| 23 23 23 0d 0d 4c 4f 43 | 41 4c 5f 56 41 52 53 3a |###..LOC|AL_VARS:|
|00000380| 20 7b 09 0d 20 20 20 20 | 24 43 6f 6e 74 72 6f 6c | {.. |$Control|
|00000390| 3b 0d 20 20 20 20 24 44 | 61 74 61 5f 68 61 6e 64 |;. $D|ata_hand|
|000003a0| 6c 65 3b 0d 20 20 20 20 | 24 48 6f 73 74 3b 0d 20 |le;. |$Host;. |
|000003b0| 20 20 20 24 4d 79 68 6f | 73 74 20 3d 20 22 53 6f | $Myho|st = "So|
|000003c0| 6d 65 2e 50 6f 6f 72 2e | 4d 61 63 22 3b 0d 23 20 |me.Poor.|Mac";.# |
|000003d0| 43 75 72 72 65 6e 74 6c | 79 20 6e 6f 20 77 61 79 |Currentl|y no way|
|000003e0| 20 74 6f 20 64 6f 20 67 | 65 74 68 6f 73 74 6e 61 | to do g|ethostna|
|000003f0| 6d 65 0d 20 20 20 20 24 | 4e 65 65 64 73 43 6c 65 |me. $|NeedsCle|
|00000400| 61 6e 75 70 3b 0d 20 20 | 20 20 24 4e 65 65 64 73 |anup;. | $Needs|
|00000410| 43 6c 6f 73 65 3b 0d 20 | 20 20 20 24 66 74 70 5f |Close;. | $ftp_|
|00000420| 65 72 72 6f 72 3b 0d 20 | 20 20 20 24 66 74 70 5f |error;. | $ftp_|
|00000430| 6d 61 74 63 68 65 64 3b | 0d 20 20 20 20 24 66 74 |matched;|. $ft|
|00000440| 70 5f 74 72 61 6e 73 5f | 66 6c 61 67 3b 0d 20 20 |p_trans_|flag;. |
|00000450| 20 20 24 66 74 70 5f 65 | 63 68 6f 3b 0d 20 20 20 | $ftp_e|cho;. |
|00000460| 20 40 66 74 70 5f 6c 69 | 73 74 3b 0d 0d 20 20 20 | @ftp_li|st;.. |
|00000470| 20 6c 6f 63 61 6c 28 40 | 74 6d 70 29 20 3d 20 67 | local(@|tmp) = g|
|00000480| 65 74 73 65 72 76 62 79 | 6e 61 6d 65 28 22 66 74 |etservby|name("ft|
|00000490| 70 22 2c 20 22 74 63 70 | 22 29 3b 0d 20 20 20 20 |p", "tcp|");. |
|000004a0| 28 24 46 54 50 20 3d 20 | 24 74 6d 70 5b 32 5d 29 |($FTP = |$tmp[2])|
|000004b0| 20 7c 7c 20 0d 09 64 69 | 65 20 22 55 6e 61 62 6c | || ..di|e "Unabl|
|000004c0| 65 20 74 6f 20 67 65 74 | 20 73 65 72 76 69 63 65 |e to get| service|
|000004d0| 20 6e 75 6d 62 65 72 20 | 66 6f 72 20 27 66 74 70 | number |for 'ftp|
|000004e0| 27 20 28 69 6e 20 66 74 | 70 6c 69 62 29 21 5c 6e |' (in ft|plib)!\n|
|000004f0| 22 3b 0d 0d 20 20 20 20 | 40 73 74 64 5f 61 63 74 |";.. |@std_act|
|00000500| 69 6f 6e 73 20 3d 20 28 | 0d 09 20 20 20 20 27 54 |ions = (|.. 'T|
|00000510| 49 4d 45 4f 55 54 27 2c | 0d 09 20 20 20 20 71 28 |IMEOUT',|.. q(|
|00000520| 24 66 74 70 5f 65 72 72 | 6f 72 20 3d 20 22 43 6f |$ftp_err|or = "Co|
|00000530| 6e 6e 65 63 74 69 6f 6e | 20 74 69 6d 65 64 20 6f |nnection| timed o|
|00000540| 75 74 20 66 6f 72 20 24 | 48 6f 73 74 21 5c 6e 22 |ut for $|Host!\n"|
|00000550| 3b 20 75 6e 64 65 66 29 | 2c 0d 09 20 20 20 20 27 |; undef)|,.. '|
|00000560| 45 4f 46 27 2c 20 0d 09 | 20 20 20 20 71 28 24 66 |EOF', ..| q($f|
|00000570| 74 70 5f 65 72 72 6f 72 | 20 3d 20 22 43 6f 6e 6e |tp_error| = "Conn|
|00000580| 65 63 74 69 6f 6e 20 74 | 6f 20 24 48 6f 73 74 20 |ection t|o $Host |
|00000590| 74 69 6d 65 64 20 6f 75 | 74 20 75 6e 65 78 70 65 |timed ou|t unexpe|
|000005a0| 63 74 65 64 6c 79 21 5c | 6e 22 3b 20 75 6e 64 65 |ctedly!\|n"; unde|
|000005b0| 66 29 0d 20 20 20 20 29 | 3b 0d 0d 20 20 20 20 40 |f). )|;.. @|
|000005c0| 73 69 67 73 20 3d 20 28 | 27 49 4e 54 27 2c 20 27 |sigs = (|'INT', '|
|000005d0| 48 55 50 27 2c 20 27 54 | 45 52 4d 27 2c 20 27 51 |HUP', 'T|ERM', 'Q|
|000005e0| 55 49 54 27 29 3b 20 20 | 23 20 73 69 67 73 20 77 |UIT'); |# sigs w|
|000005f0| 65 27 6c 6c 20 63 61 74 | 63 68 20 26 20 74 65 72 |e'll cat|ch & ter|
|00000600| 6d 69 6e 61 74 65 20 6f | 6e 0d 7d 0d 0d 0d 0d 23 |minate o|n.}....#|
|00000610| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000620| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000630| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000640| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000650| 23 23 23 23 23 23 23 23 | 23 23 0d 23 0d 23 20 20 |########|##.#.# |
|00000660| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 61 72 |The foll|owing ar|
|00000670| 65 20 69 6e 74 65 6e 64 | 65 64 20 74 6f 20 62 65 |e intend|ed to be|
|00000680| 20 74 68 65 20 75 73 65 | 72 2d 63 61 6c 6c 61 62 | the use|r-callab|
|00000690| 6c 65 20 72 6f 75 74 69 | 6e 65 73 2e 0d 23 20 20 |le routi|nes..# |
|000006a0| 45 61 63 68 20 6f 66 20 | 74 68 65 73 65 20 64 6f |Each of |these do|
|000006b0| 65 73 20 6f 6e 65 20 6f | 66 20 74 68 65 20 66 74 |es one o|f the ft|
|000006c0| 70 20 6b 65 79 77 6f 72 | 64 20 66 75 6e 63 74 69 |p keywor|d functi|
|000006d0| 6f 6e 73 2e 0d 23 0d 23 | 23 23 23 23 23 23 23 23 |ons..#.#|########|
|000006e0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000006f0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000700| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000710| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000720| 23 23 0d 0d 73 75 62 20 | 65 72 72 6f 72 20 7b 20 |##..sub |error { |
|00000730| 23 23 20 50 75 62 6c 69 | 63 0d 20 20 20 20 24 66 |## Publi|c. $f|
|00000740| 74 70 5f 65 72 72 6f 72 | 3b 0d 7d 0d 0d 73 75 62 |tp_error|;.}..sub|
|00000750| 20 65 63 68 6f 20 7b 20 | 23 23 20 50 75 62 6c 69 | echo { |## Publi|
|00000760| 63 0d 20 20 20 20 28 24 | 66 74 70 5f 65 63 68 6f |c. ($|ftp_echo|
|00000770| 29 20 3d 20 40 5f 3b 0d | 7d 0d 20 20 0d 23 23 23 |) = @_;.|}. .###|
|00000780| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000790| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000007a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000007b0| 23 23 23 23 0d 0d 23 20 | 20 20 63 64 20 75 70 20 |####..# | cd up |
|000007c0| 61 20 64 69 72 65 63 74 | 6f 72 79 20 6c 65 76 65 |a direct|ory leve|
|000007d0| 6c 0d 0d 73 75 62 20 63 | 64 75 70 20 7b 20 23 23 |l..sub c|dup { ##|
|000007e0| 20 50 75 62 6c 69 63 0d | 20 20 20 20 26 64 6f 5f | Public.| &do_|
|000007f0| 66 74 70 5f 63 6d 64 28 | 32 30 30 2c 20 22 63 64 |ftp_cmd(|200, "cd|
|00000800| 75 70 22 29 3b 0d 7d 0d | 0d 23 23 23 23 23 23 23 |up");.}.|.#######|
|00000810| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000820| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000830| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000840| 0d 0d 23 20 63 6c 6f 73 | 65 20 61 6e 20 6f 70 65 |..# clos|e an ope|
|00000850| 6e 20 66 74 70 20 63 6f | 6e 6e 65 63 74 69 6f 6e |n ftp co|nnection|
|00000860| 0d 0d 73 75 62 20 63 6c | 6f 73 65 20 7b 20 23 23 |..sub cl|ose { ##|
|00000870| 20 50 75 62 6c 69 63 0d | 20 20 20 20 72 65 74 75 | Public.| retu|
|00000880| 72 6e 20 75 6e 6c 65 73 | 73 20 24 4e 65 65 64 73 |rn unles|s $Needs|
|00000890| 43 6c 6f 73 65 3b 0d 20 | 20 20 20 26 64 6f 5f 66 |Close;. | &do_f|
|000008a0| 74 70 5f 63 6d 64 28 32 | 32 31 2c 20 22 71 75 69 |tp_cmd(2|21, "qui|
|000008b0| 74 22 29 3b 0d 20 20 20 | 20 26 6d 61 63 63 68 61 |t");. | &maccha|
|000008c0| 74 27 63 6c 6f 73 65 28 | 24 43 6f 6e 74 72 6f 6c |t'close(|$Control|
|000008d0| 29 3b 0d 20 20 20 20 75 | 6e 64 65 66 20 24 4e 65 |);. u|ndef $Ne|
|000008e0| 65 64 73 43 6c 6f 73 65 | 3b 0d 20 20 20 20 26 64 |edsClose|;. &d|
|000008f0| 6f 5f 66 74 70 5f 73 69 | 67 6e 61 6c 73 28 30 29 |o_ftp_si|gnals(0)|
|00000900| 3b 0d 7d 0d 0d 23 23 23 | 23 23 23 23 23 23 23 23 |;.}..###|########|
|00000910| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000920| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000930| 23 23 23 23 23 23 23 23 | 23 23 23 23 0d 0d 23 20 |########|####..# |
|00000940| 63 68 61 6e 67 65 20 72 | 65 6d 6f 74 65 20 64 69 |change r|emote di|
|00000950| 72 65 63 74 6f 72 79 0d | 0d 73 75 62 20 63 77 64 |rectory.|.sub cwd|
|00000960| 20 7b 20 23 23 20 50 75 | 62 6c 69 63 0d 20 20 20 | { ## Pu|blic. |
|00000970| 20 26 64 6f 5f 66 74 70 | 5f 63 6d 64 28 32 35 30 | &do_ftp|_cmd(250|
|00000980| 2c 20 22 63 77 64 22 2c | 20 40 5f 29 3b 0d 7d 0d |, "cwd",| @_);.}.|
|00000990| 20 20 0d 23 23 23 23 23 | 23 23 23 23 23 23 23 23 | .#####|########|
|000009a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000009b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000009c0| 23 23 23 23 23 23 23 23 | 23 23 0d 0d 23 20 20 64 |########|##..# d|
|000009d0| 65 6c 65 74 65 20 61 20 | 72 65 6d 6f 74 65 20 66 |elete a |remote f|
|000009e0| 69 6c 65 0d 0d 73 75 62 | 20 64 65 6c 65 74 65 20 |ile..sub| delete |
|000009f0| 7b 20 23 23 20 50 75 62 | 6c 69 63 0d 20 20 20 20 |{ ## Pub|lic. |
|00000a00| 20 26 64 6f 5f 66 74 70 | 5f 63 6d 64 28 32 35 30 | &do_ftp|_cmd(250|
|00000a10| 2c 20 22 64 65 6c 65 22 | 2c 20 40 5f 29 3b 20 0d |, "dele"|, @_); .|
|00000a20| 7d 0d 0d 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |}..#####|########|
|00000a30| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000a40| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000a50| 23 23 23 23 23 23 23 23 | 23 23 0d 0d 23 20 20 67 |########|##..# g|
|00000a60| 65 74 20 61 20 64 69 72 | 65 63 74 6f 72 79 20 6c |et a dir|ectory l|
|00000a70| 69 73 74 69 6e 67 20 6f | 66 20 72 65 6d 6f 74 65 |isting o|f remote|
|00000a80| 20 64 69 72 65 63 74 6f | 72 79 20 28 22 6c 73 20 | directo|ry ("ls |
|00000a90| 2d 6c 22 29 0d 0d 73 75 | 62 20 64 69 72 20 7b 20 |-l")..su|b dir { |
|00000aa0| 23 23 20 50 75 62 6c 69 | 63 0d 20 20 20 20 26 64 |## Publi|c. &d|
|00000ab0| 6f 5f 66 74 70 5f 6c 69 | 73 74 69 6e 67 28 22 6c |o_ftp_li|sting("l|
|00000ac0| 69 73 74 22 2c 20 40 5f | 29 3b 0d 7d 0d 0d 23 23 |ist", @_|);.}..##|
|00000ad0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000ae0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000af0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000b00| 23 23 23 23 23 0d 0d 23 | 20 20 67 65 74 20 61 20 |#####..#| get a |
|00000b10| 72 65 6d 6f 74 65 20 66 | 69 6c 65 20 74 6f 20 61 |remote f|ile to a|
|00000b20| 20 6c 6f 63 61 6c 20 66 | 69 6c 65 0d 23 20 20 20 | local f|ile.# |
|00000b30| 20 67 65 74 28 72 65 6d | 6f 74 65 5b 2c 20 6c 6f | get(rem|ote[, lo|
|00000b40| 63 61 6c 5d 29 0d 0d 73 | 75 62 20 67 65 74 20 7b |cal])..s|ub get {|
|00000b50| 20 23 23 20 50 75 62 6c | 69 63 0d 20 20 20 20 6c | ## Publ|ic. l|
|00000b60| 6f 63 61 6c 28 24 72 65 | 6d 6f 74 65 2c 20 24 6c |ocal($re|mote, $l|
|00000b70| 6f 63 61 6c 29 20 3d 20 | 40 5f 3b 0d 20 20 20 20 |ocal) = |@_;. |
|00000b80| 28 24 6c 6f 63 61 6c 20 | 3d 20 24 72 65 6d 6f 74 |($local |= $remot|
|00000b90| 65 29 20 75 6e 6c 65 73 | 73 20 24 6c 6f 63 61 6c |e) unles|s $local|
|00000ba0| 3b 0d 0d 20 20 20 20 75 | 6e 6c 65 73 73 20 28 6f |;.. u|nless (o|
|00000bb0| 70 65 6e 28 44 46 49 4c | 45 2c 20 22 3e 24 6c 6f |pen(DFIL|E, ">$lo|
|00000bc0| 63 61 6c 22 29 29 20 7b | 0d 09 24 66 74 70 5f 65 |cal")) {|..$ftp_e|
|00000bd0| 72 72 6f 72 20 3d 20 20 | 22 4f 70 65 6e 20 6f 66 |rror = |"Open of|
|00000be0| 20 6c 6f 63 61 6c 20 66 | 69 6c 65 20 24 6c 6f 63 | local f|ile $loc|
|00000bf0| 61 6c 20 66 61 69 6c 65 | 64 3a 20 24 21 22 3b 0d |al faile|d: $!";.|
|00000c00| 09 72 65 74 75 72 6e 20 | 75 6e 64 65 66 3b 0d 20 |.return |undef;. |
|00000c10| 20 20 20 7d 20 65 6c 73 | 65 20 7b 0d 09 24 4e 65 | } els|e {..$Ne|
|00000c20| 65 64 73 43 6c 65 61 6e | 75 70 20 3d 20 24 6c 6f |edsClean|up = $lo|
|00000c30| 63 61 6c 3b 0d 20 20 20 | 20 7d 0d 0d 20 20 20 20 |cal;. | }.. |
|00000c40| 72 65 74 75 72 6e 20 75 | 6e 64 65 66 20 75 6e 6c |return u|ndef unl|
|00000c50| 65 73 73 20 26 64 6f 5f | 6f 70 65 6e 5f 64 70 6f |ess &do_|open_dpo|
|00000c60| 72 74 3b 20 09 23 20 4f | 70 65 6e 20 61 20 64 61 |rt; .# O|pen a da|
|00000c70| 74 61 20 63 68 61 6e 6e | 65 6c 0d 20 20 20 20 75 |ta chann|el. u|
|00000c80| 6e 6c 65 73 73 20 28 26 | 64 6f 5f 66 74 70 5f 63 |nless (&|do_ftp_c|
|00000c90| 6d 64 28 31 35 30 2c 20 | 22 72 65 74 72 20 24 72 |md(150, |"retr $r|
|00000ca0| 65 6d 6f 74 65 22 29 29 | 20 7b 0d 09 24 66 74 70 |emote"))| {..$ftp|
|00000cb0| 5f 65 72 72 6f 72 20 2e | 3d 20 22 5c 6e 46 69 6c |_error .|= "\nFil|
|00000cc0| 65 20 24 72 65 6d 6f 74 | 65 20 6e 6f 74 20 66 65 |e $remot|e not fe|
|00000cd0| 74 63 68 65 64 20 66 72 | 6f 6d 20 24 48 6f 73 74 |tched fr|om $Host|
|00000ce0| 5c 6e 22 3b 0d 09 63 6c | 6f 73 65 20 44 46 49 4c |\n";..cl|ose DFIL|
|00000cf0| 45 3b 0d 09 75 6e 6c 69 | 6e 6b 20 24 6c 6f 63 61 |E;..unli|nk $loca|
|00000d00| 6c 3b 0d 09 75 6e 64 65 | 66 20 24 4e 65 65 64 73 |l;..unde|f $Needs|
|00000d10| 43 6c 65 61 6e 75 70 3b | 0d 09 72 65 74 75 72 6e |Cleanup;|..return|
|00000d20| 3b 0d 20 20 20 20 7d 0d | 0d 20 20 20 20 24 66 74 |;. }.|. $ft|
|00000d30| 70 5f 74 72 61 6e 73 5f | 66 6c 61 67 20 3d 20 30 |p_trans_|flag = 0|
|00000d40| 3b 0d 0d 20 20 20 20 64 | 6f 20 7b 0d 09 26 6d 61 |;.. d|o {..&ma|
|00000d50| 63 63 68 61 74 27 65 78 | 70 65 63 74 28 24 44 61 |cchat'ex|pect($Da|
|00000d60| 74 61 5f 68 61 6e 64 6c | 65 2c 20 36 30 2c 0d 09 |ta_handl|e, 60,..|
|00000d70| 09 20 20 20 20 20 27 2e | 7c 5c 6e 27 2c 20 71 7b |. '.||\n', q{|
|00000d80| 24 6d 61 63 63 68 61 74 | 27 74 68 69 73 62 75 66 |$macchat|'thisbuf|
|00000d90| 20 3d 7e 20 73 7c 5c 30 | 31 35 5c 30 31 32 7c 5c | =~ s|\0|15\012|\|
|00000da0| 6e 7c 67 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |n|g;. | |
|00000db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000dc0| 20 20 20 20 70 72 69 6e | 74 20 44 46 49 4c 45 20 | prin|t DFILE |
|00000dd0| 28 24 6d 61 63 63 68 61 | 74 27 74 68 69 73 62 75 |($maccha|t'thisbu|
|00000de0| 66 29 20 7c 7c 0d 09 09 | 09 28 24 66 74 70 5f 74 |f) ||...|.($ftp_t|
|00000df0| 72 61 6e 73 5f 66 6c 61 | 67 20 3d 20 33 29 3b 20 |rans_fla|g = 3); |
|00000e00| 75 6e 64 65 66 20 24 6d | 61 63 63 68 61 74 27 53 |undef $m|acchat'S|
|00000e10| 7d 2c 0d 09 09 20 20 20 | 20 20 27 45 4f 46 27 2c |},... | 'EOF',|
|00000e20| 20 20 27 24 66 74 70 5f | 74 72 61 6e 73 5f 66 6c | '$ftp_|trans_fl|
|00000e30| 61 67 20 3d 20 31 27 2c | 0d 09 09 20 20 20 20 20 |ag = 1',|... |
|00000e40| 27 54 49 4d 45 4f 55 54 | 27 2c 20 27 24 66 74 70 |'TIMEOUT|', '$ftp|
|00000e50| 5f 74 72 61 6e 73 5f 66 | 6c 61 67 20 3d 20 32 27 |_trans_f|lag = 2'|
|00000e60| 29 3b 0d 20 20 20 20 7d | 20 75 6e 74 69 6c 20 24 |);. }| until $|
|00000e70| 66 74 70 5f 74 72 61 6e | 73 5f 66 6c 61 67 3b 0d |ftp_tran|s_flag;.|
|00000e80| 0d 20 20 20 20 63 6c 6f | 73 65 20 44 46 49 4c 45 |. clo|se DFILE|
|00000e90| 3b 0d 20 20 20 20 26 6d | 61 63 63 68 61 74 27 63 |;. &m|acchat'c|
|00000ea0| 6c 6f 73 65 28 24 44 61 | 74 61 5f 68 61 6e 64 6c |lose($Da|ta_handl|
|00000eb0| 65 29 3b 09 09 23 20 43 | 6c 6f 73 65 20 74 68 65 |e);..# C|lose the|
|00000ec0| 20 64 61 74 61 20 63 68 | 61 6e 6e 65 6c 0d 0d 20 | data ch|annel.. |
|00000ed0| 20 20 20 75 6e 64 65 66 | 20 24 4e 65 65 64 73 43 | undef| $NeedsC|
|00000ee0| 6c 65 61 6e 75 70 3b 0d | 20 20 20 20 69 66 20 28 |leanup;.| if (|
|00000ef0| 24 66 74 70 5f 74 72 61 | 6e 73 5f 66 6c 61 67 20 |$ftp_tra|ns_flag |
|00000f00| 3e 20 31 29 20 7b 0d 09 | 75 6e 6c 69 6e 6b 20 24 |> 1) {..|unlink $|
|00000f10| 6c 6f 63 61 6c 3b 0d 09 | 24 66 74 70 5f 65 72 72 |local;..|$ftp_err|
|00000f20| 6f 72 20 3d 20 22 55 6e | 65 78 70 65 63 74 65 64 |or = "Un|expected|
|00000f30| 20 22 20 2e 20 28 24 66 | 74 70 5f 74 72 61 6e 73 | " . ($f|tp_trans|
|00000f40| 5f 66 6c 61 67 20 3d 3d | 20 32 20 3f 20 22 74 69 |_flag ==| 2 ? "ti|
|00000f50| 6d 65 6f 75 74 22 20 3a | 0d 09 09 28 24 66 74 70 |meout" :|...($ftp|
|00000f60| 5f 74 72 61 6e 73 5f 66 | 6c 61 67 20 21 3d 20 33 |_trans_f|lag != 3|
|00000f70| 20 3f 20 22 66 61 69 6c | 75 72 65 22 20 3a 20 22 | ? "fail|ure" : "|
|00000f80| 6c 6f 63 61 6c 20 77 72 | 69 74 65 20 66 61 69 6c |local wr|ite fail|
|00000f90| 75 72 65 22 29 29 20 2e | 0d 20 20 20 20 20 20 20 |ure")) .|. |
|00000fa0| 20 20 20 20 20 20 20 20 | 20 22 20 67 65 74 74 69 | | " getti|
|00000fb0| 6e 67 20 24 72 65 6d 6f | 74 65 5c 6e 22 3b 0d 20 |ng $remo|te\n";. |
|00000fc0| 20 20 20 7d 0d 20 20 20 | 20 0d 20 20 20 20 26 64 | }. | . &d|
|00000fd0| 6f 5f 66 74 70 5f 63 6d | 64 28 32 32 36 29 3b 0d |o_ftp_cm|d(226);.|
|00000fe0| 7d 0d 0d 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |}..#####|########|
|00000ff0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001000| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001010| 23 23 23 23 23 23 23 23 | 23 23 0d 0d 23 20 20 70 |########|##..# p|
|00001020| 75 74 20 61 20 6c 6f 63 | 61 6c 20 66 69 6c 65 20 |ut a loc|al file |
|00001030| 74 6f 20 61 20 72 65 6d | 6f 74 65 20 66 69 6c 65 |to a rem|ote file|
|00001040| 0d 23 20 20 20 20 70 75 | 74 28 6c 6f 63 61 6c 5b |.# pu|t(local[|
|00001050| 2c 20 72 65 6d 6f 74 65 | 5d 29 0d 0d 73 75 62 20 |, remote|])..sub |
|00001060| 70 75 74 20 7b 20 23 23 | 20 50 75 62 6c 69 63 0d |put { ##| Public.|
|00001070| 20 20 20 20 6c 6f 63 61 | 6c 28 24 6c 6f 63 61 6c | loca|l($local|
|00001080| 2c 20 24 72 65 6d 6f 74 | 65 29 20 3d 20 40 5f 3b |, $remot|e) = @_;|
|00001090| 0d 20 20 20 20 28 24 72 | 65 6d 6f 74 65 20 3d 20 |. ($r|emote = |
|000010a0| 24 6c 6f 63 61 6c 29 20 | 75 6e 6c 65 73 73 20 24 |$local) |unless $|
|000010b0| 72 65 6d 6f 74 65 3b 0d | 0d 20 20 20 20 75 6e 6c |remote;.|. unl|
|000010c0| 65 73 73 20 28 6f 70 65 | 6e 28 44 46 49 4c 45 2c |ess (ope|n(DFILE,|
|000010d0| 20 22 3c 24 6c 6f 63 61 | 6c 22 29 29 20 7b 0d 09 | "<$loca|l")) {..|
|000010e0| 24 66 74 70 5f 65 72 72 | 6f 72 20 3d 20 20 22 4f |$ftp_err|or = "O|
|000010f0| 70 65 6e 20 6f 66 20 6c | 6f 63 61 6c 20 66 69 6c |pen of l|ocal fil|
|00001100| 65 20 24 6c 6f 63 61 6c | 20 66 61 69 6c 65 64 3a |e $local| failed:|
|00001110| 20 24 21 22 3b 0d 09 72 | 65 74 75 72 6e 20 75 6e | $!";..r|eturn un|
|00001120| 64 65 66 3b 0d 20 20 20 | 20 7d 20 0d 0d 20 20 20 |def;. | } .. |
|00001130| 20 72 65 74 75 72 6e 20 | 75 6e 64 65 66 20 75 6e | return |undef un|
|00001140| 6c 65 73 73 20 26 64 6f | 5f 6f 70 65 6e 5f 64 70 |less &do|_open_dp|
|00001150| 6f 72 74 3b 20 09 23 20 | 4f 70 65 6e 20 61 20 64 |ort; .# |Open a d|
|00001160| 61 74 61 20 63 68 61 6e | 6e 65 6c 0d 20 20 20 20 |ata chan|nel. |
|00001170| 75 6e 6c 65 73 73 20 28 | 26 64 6f 5f 66 74 70 5f |unless (|&do_ftp_|
|00001180| 63 6d 64 28 31 35 30 2c | 20 22 73 74 6f 72 20 24 |cmd(150,| "stor $|
|00001190| 72 65 6d 6f 74 65 22 29 | 29 20 7b 0d 09 24 66 74 |remote")|) {..$ft|
|000011a0| 70 5f 65 72 72 6f 72 20 | 2e 3d 20 22 5c 6e 46 69 |p_error |.= "\nFi|
|000011b0| 6c 65 20 24 72 65 6d 6f | 74 65 20 6e 6f 74 20 73 |le $remo|te not s|
|000011c0| 74 6f 72 65 64 20 6f 6e | 20 24 48 6f 73 74 5c 6e |tored on| $Host\n|
|000011d0| 22 3b 0d 09 63 6c 6f 73 | 65 20 44 46 49 4c 45 3b |";..clos|e DFILE;|
|000011e0| 0d 09 72 65 74 75 72 6e | 20 75 6e 64 65 66 3b 0d |..return| undef;.|
|000011f0| 20 20 20 20 7d 0d 0d 20 | 20 20 20 26 6d 61 63 63 | }.. | &macc|
|00001200| 68 61 74 27 65 78 70 65 | 63 74 28 24 44 61 74 61 |hat'expe|ct($Data|
|00001210| 5f 68 61 6e 64 6c 65 2c | 20 30 29 3b 20 20 20 20 |_handle,| 0); |
|00001220| 20 20 20 20 20 20 20 20 | 20 20 23 20 46 6f 72 63 | | # Forc|
|00001230| 65 20 6d 61 63 63 68 61 | 74 20 74 6f 20 64 6f 20 |e maccha|t to do |
|00001240| 61 6e 20 61 63 63 65 70 | 74 0d 0d 20 20 20 20 77 |an accep|t.. w|
|00001250| 68 69 6c 65 20 28 3c 44 | 46 49 4c 45 3e 29 20 7b |hile (<D|FILE>) {|
|00001260| 0d 20 20 20 20 20 20 20 | 20 63 68 6f 70 3b 0d 09 |. | chop;..|
|00001270| 26 6d 61 63 63 68 61 74 | 27 70 72 69 6e 74 28 24 |&macchat|'print($|
|00001280| 44 61 74 61 5f 68 61 6e | 64 6c 65 2c 20 22 24 5f |Data_han|dle, "$_|
|00001290| 5c 30 31 35 5c 30 31 32 | 22 29 3b 0d 20 20 20 20 |\015\012|");. |
|000012a0| 7d 0d 0d 20 20 20 20 63 | 6c 6f 73 65 20 44 46 49 |}.. c|lose DFI|
|000012b0| 4c 45 3b 0d 20 20 20 20 | 26 6d 61 63 63 68 61 74 |LE;. |&macchat|
|000012c0| 27 63 6c 6f 73 65 28 24 | 44 61 74 61 5f 68 61 6e |'close($|Data_han|
|000012d0| 64 6c 65 29 3b 09 09 20 | 20 20 20 20 20 20 20 23 |dle);.. | #|
|000012e0| 20 43 6c 6f 73 65 20 74 | 68 65 20 64 61 74 61 20 | Close t|he data |
|000012f0| 63 68 61 6e 6e 65 6c 0d | 20 20 20 20 0d 20 20 20 |channel.| . |
|00001300| 20 26 64 6f 5f 66 74 70 | 5f 63 6d 64 28 32 32 36 | &do_ftp|_cmd(226|
|00001310| 29 3b 0d 7d 0d 0d 23 23 | 23 23 23 23 23 23 23 23 |);.}..##|########|
|00001320| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001330| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001340| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 0d 0d 23 |########|#####..#|
|00001350| 20 20 44 6f 20 61 20 73 | 69 6d 70 6c 65 20 6e 61 | Do a s|imple na|
|00001360| 6d 65 20 6c 69 73 74 20 | 28 22 6c 73 22 29 0d 0d |me list |("ls")..|
|00001370| 73 75 62 20 6c 69 73 74 | 20 7b 20 23 23 20 50 75 |sub list| { ## Pu|
|00001380| 62 6c 69 63 0d 20 20 20 | 20 26 64 6f 5f 66 74 70 |blic. | &do_ftp|
|00001390| 5f 6c 69 73 74 69 6e 67 | 28 22 6e 6c 73 74 22 2c |_listing|("nlst",|
|000013a0| 20 40 5f 29 3b 0d 7d 0d | 0d 23 23 23 23 23 23 23 | @_);.}.|.#######|
|000013b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000013c0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000013d0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000013e0| 0d 0d 23 20 20 20 4d 61 | 6b 65 20 61 20 72 65 6d |..# Ma|ke a rem|
|000013f0| 6f 74 65 20 64 69 72 65 | 63 74 6f 72 79 0d 0d 73 |ote dire|ctory..s|
|00001400| 75 62 20 6d 6b 64 69 72 | 20 7b 20 23 23 20 50 75 |ub mkdir| { ## Pu|
|00001410| 62 6c 69 63 0d 20 20 20 | 20 26 64 6f 5f 66 74 70 |blic. | &do_ftp|
|00001420| 5f 63 6d 64 28 32 35 37 | 2c 20 22 6d 6b 64 22 2c |_cmd(257|, "mkd",|
|00001430| 20 40 5f 29 3b 0d 7d 0d | 0d 23 23 23 23 23 23 23 | @_);.}.|.#######|
|00001440| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001450| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001460| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001470| 0d 0d 23 20 20 4f 70 65 | 6e 20 61 6e 20 66 74 70 |..# Ope|n an ftp|
|00001480| 20 63 6f 6e 6e 65 63 74 | 69 6f 6e 20 74 6f 20 72 | connect|ion to r|
|00001490| 65 6d 6f 74 65 20 68 6f | 73 74 0d 0d 73 75 62 20 |emote ho|st..sub |
|000014a0| 6f 70 65 6e 20 7b 20 20 | 23 23 20 50 75 62 6c 69 |open { |## Publi|
|000014b0| 63 0d 20 20 20 20 69 66 | 20 28 24 4e 65 65 64 73 |c. if| ($Needs|
|000014c0| 43 6c 6f 73 65 29 20 7b | 0d 09 24 66 74 70 5f 65 |Close) {|..$ftp_e|
|000014d0| 72 72 6f 72 20 3d 20 22 | 43 6f 6e 6e 65 63 74 69 |rror = "|Connecti|
|000014e0| 6f 6e 20 73 74 69 6c 6c | 20 6f 70 65 6e 20 74 6f |on still| open to|
|000014f0| 20 24 48 6f 73 74 21 22 | 3b 0d 09 72 65 74 75 72 | $Host!"|;..retur|
|00001500| 6e 20 75 6e 64 65 66 3b | 0d 20 20 20 20 7d 0d 0d |n undef;|. }..|
|00001510| 20 20 20 20 24 48 6f 73 | 74 20 3d 20 73 68 69 66 | $Hos|t = shif|
|00001520| 74 28 40 5f 29 3b 0d 0d | 20 20 20 20 6c 6f 63 61 |t(@_);..| loca|
|00001530| 6c 28 24 50 6f 72 74 29 | 20 3d 20 24 46 54 50 3b |l($Port)| = $FTP;|
|00001540| 0d 0d 20 20 20 20 69 66 | 20 28 24 48 6f 73 74 20 |.. if| ($Host |
|00001550| 3d 7e 20 2f 28 2e 2a 29 | 5c 73 2b 28 5b 30 2d 39 |=~ /(.*)|\s+([0-9|
|00001560| 5d 2b 29 2f 29 20 7b 0d | 09 28 24 48 6f 73 74 2c |]+)/) {.|.($Host,|
|00001570| 20 24 50 6f 72 74 29 20 | 3d 20 28 24 31 2c 20 24 | $Port) |= ($1, $|
|00001580| 32 29 3b 0d 20 20 20 20 | 7d 0d 0d 20 20 20 20 6c |2);. |}.. l|
|00001590| 6f 63 61 6c 28 24 55 73 | 65 72 2c 20 24 50 61 73 |ocal($Us|er, $Pas|
|000015a0| 73 77 6f 72 64 2c 20 24 | 41 63 63 74 29 20 3d 20 |sword, $|Acct) = |
|000015b0| 40 5f 3b 0d 20 20 20 20 | 24 55 73 65 72 20 3d 20 |@_;. |$User = |
|000015c0| 22 61 6e 6f 6e 79 6d 6f | 75 73 22 20 75 6e 6c 65 |"anonymo|us" unle|
|000015d0| 73 73 20 24 55 73 65 72 | 3b 0d 20 20 20 20 24 50 |ss $User|;. $P|
|000015e0| 61 73 73 77 6f 72 64 20 | 3d 20 22 2d 22 20 2e 20 |assword |= "-" . |
|000015f0| 24 6d 61 69 6e 27 45 4e | 56 7b 27 55 53 45 52 27 |$main'EN|V{'USER'|
|00001600| 7d 20 2e 20 22 40 24 4d | 79 68 6f 73 74 22 20 75 |} . "@$M|yhost" u|
|00001610| 6e 6c 65 73 73 20 24 50 | 61 73 73 77 6f 72 64 3b |nless $P|assword;|
|00001620| 0d 20 20 20 20 24 66 74 | 70 5f 65 72 72 6f 72 20 |. $ft|p_error |
|00001630| 3d 20 27 27 3b 0d 0d 20 | 20 20 20 75 6e 6c 65 73 |= '';.. | unles|
|00001640| 73 28 24 43 6f 6e 74 72 | 6f 6c 20 3d 20 0d 20 20 |s($Contr|ol = . |
|00001650| 20 20 09 26 6d 61 63 63 | 68 61 74 27 6f 70 65 6e | .&macc|hat'open|
|00001660| 5f 70 6f 72 74 28 0d 09 | 09 26 47 55 53 49 27 41 |_port(..|.&GUSI'A|
|00001670| 46 5f 49 4e 45 54 2c 20 | 26 47 55 53 49 27 70 61 |F_INET, |&GUSI'pa|
|00001680| 63 6b 5f 73 6f 63 6b 61 | 64 64 72 5f 69 6e 28 26 |ck_socka|ddr_in(&|
|00001690| 47 55 53 49 27 41 46 5f | 49 4e 45 54 2c 20 24 48 |GUSI'AF_|INET, $H|
|000016a0| 6f 73 74 2c 20 24 50 6f | 72 74 29 29 29 20 7b 0d |ost, $Po|rt))) {.|
|000016b0| 09 24 66 74 70 5f 65 72 | 72 6f 72 20 3d 20 22 55 |.$ftp_er|ror = "U|
|000016c0| 6e 61 62 6c 65 20 74 6f | 20 63 6f 6e 6e 65 63 74 |nable to| connect|
|000016d0| 20 74 6f 20 24 48 6f 73 | 74 22 3b 0d 09 69 66 20 | to $Hos|t";..if |
|000016e0| 28 24 50 6f 72 74 20 3d | 3d 20 24 46 54 50 29 20 |($Port =|= $FTP) |
|000016f0| 7b 0d 09 20 20 20 20 24 | 66 74 70 5f 65 72 72 6f |{.. $|ftp_erro|
|00001700| 72 20 2e 3d 20 22 20 66 | 74 70 20 70 6f 72 74 3a |r .= " f|tp port:|
|00001710| 20 24 21 22 3b 0d 09 7d | 20 65 6c 73 65 20 7b 0d | $!";..}| else {.|
|00001720| 09 20 20 20 20 24 66 74 | 70 5f 65 72 72 6f 72 20 |. $ft|p_error |
|00001730| 2e 3d 20 22 20 70 6f 72 | 74 20 24 50 6f 72 74 3a |.= " por|t $Port:|
|00001740| 20 24 21 22 3b 0d 09 7d | 0d 09 72 65 74 75 72 6e | $!";..}|..return|
|00001750| 20 75 6e 64 65 66 3b 0d | 20 20 20 20 7d 0d 0d 20 | undef;.| }.. |
|00001760| 20 20 20 75 6e 6c 65 73 | 73 28 26 6d 61 63 63 68 | unles|s(&macch|
|00001770| 61 74 27 65 78 70 65 63 | 74 28 24 43 6f 6e 74 72 |at'expec|t($Contr|
|00001780| 6f 6c 2c 20 36 30 2c 0d | 09 09 20 20 20 20 20 20 |ol, 60,.|.. |
|00001790| 20 20 27 5e 32 32 30 20 | 2e 2a 5c 30 31 35 5c 30 | '^220 |.*\015\0|
|000017a0| 31 32 27 2c 09 22 31 22 | 2c 0d 09 09 20 20 20 20 |12',."1"|,... |
|000017b0| 20 20 20 20 27 5e 5c 64 | 5c 64 5c 64 20 2e 2a 5c | '^\d|\d\d .*\|
|000017c0| 30 31 35 5c 30 31 32 27 | 2c 20 20 09 22 75 6e 64 |015\012'|, ."und|
|000017d0| 65 66 22 29 29 20 7b 0d | 09 24 66 74 70 5f 65 72 |ef")) {.|.$ftp_er|
|000017e0| 72 6f 72 20 3d 20 22 45 | 72 72 6f 72 20 65 73 74 |ror = "E|rror est|
|000017f0| 61 62 6c 69 73 68 69 6e | 67 20 63 6f 6e 74 72 6f |ablishin|g contro|
|00001800| 6c 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 74 6f 20 |l connec|tion to |
|00001810| 24 48 6f 73 74 22 3b 0d | 20 20 20 20 20 20 20 20 |$Host";.| |
|00001820| 26 6d 61 63 63 68 61 74 | 27 63 6c 6f 73 65 28 24 |&macchat|'close($|
|00001830| 43 6f 6e 74 72 6f 6c 29 | 3b 0d 09 72 65 74 75 72 |Control)|;..retur|
|00001840| 6e 20 75 6e 64 65 66 3b | 0d 20 20 20 20 7d 0d 20 |n undef;|. }. |
|00001850| 20 20 20 26 64 6f 5f 66 | 74 70 5f 73 69 67 6e 61 | &do_f|tp_signa|
|00001860| 6c 73 28 24 4e 65 65 64 | 73 43 6c 6f 73 65 20 3d |ls($Need|sClose =|
|00001870| 20 31 29 3b 0d 0d 20 20 | 20 20 75 6e 6c 65 73 73 | 1);.. | unless|
|00001880| 20 28 26 64 6f 5f 66 74 | 70 5f 63 6d 64 28 33 33 | (&do_ft|p_cmd(33|
|00001890| 31 2c 20 22 75 73 65 72 | 20 24 55 73 65 72 22 29 |1, "user| $User")|
|000018a0| 29 20 7b 0d 09 24 66 74 | 70 5f 65 72 72 6f 72 20 |) {..$ft|p_error |
|000018b0| 2e 3d 20 22 5c 6e 55 73 | 65 72 20 63 6f 6d 6d 61 |.= "\nUs|er comma|
|000018c0| 6e 64 20 66 61 69 6c 65 | 64 20 65 73 74 61 62 6c |nd faile|d establ|
|000018d0| 69 73 68 69 6e 67 20 63 | 6f 6e 6e 65 63 74 69 6f |ishing c|onnectio|
|000018e0| 6e 20 74 6f 20 24 48 6f | 73 74 22 3b 0d 09 72 65 |n to $Ho|st";..re|
|000018f0| 74 75 72 6e 20 75 6e 64 | 65 66 3b 0d 20 20 20 20 |turn und|ef;. |
|00001900| 7d 0d 0d 20 20 20 20 75 | 6e 6c 65 73 73 20 28 26 |}.. u|nless (&|
|00001910| 64 6f 5f 66 74 70 5f 63 | 6d 64 28 22 28 32 33 30 |do_ftp_c|md("(230|
|00001920| 7c 33 33 32 7c 32 30 32 | 29 22 2c 20 22 70 61 73 ||332|202|)", "pas|
|00001930| 73 20 24 50 61 73 73 77 | 6f 72 64 22 29 29 20 7b |s $Passw|ord")) {|
|00001940| 0d 09 24 66 74 70 5f 65 | 72 72 6f 72 20 2e 3d 20 |..$ftp_e|rror .= |
|00001950| 22 5c 6e 50 61 73 73 77 | 6f 72 64 20 63 6f 6d 6d |"\nPassw|ord comm|
|00001960| 61 6e 64 20 66 61 69 6c | 65 64 20 65 73 74 61 62 |and fail|ed estab|
|00001970| 6c 69 73 68 69 6e 67 20 | 63 6f 6e 6e 65 63 74 69 |lishing |connecti|
|00001980| 6f 6e 20 74 6f 20 24 48 | 6f 73 74 22 3b 0d 09 72 |on to $H|ost";..r|
|00001990| 65 74 75 72 6e 20 75 6e | 64 65 66 3b 0d 20 20 20 |eturn un|def;. |
|000019a0| 20 7d 0d 0d 20 20 20 20 | 72 65 74 75 72 6e 20 31 | }.. |return 1|
|000019b0| 20 75 6e 6c 65 73 73 20 | 24 41 63 63 74 3b 0d 0d | unless |$Acct;..|
|000019c0| 20 20 20 20 75 6e 6c 65 | 73 73 20 28 26 64 6f 5f | unle|ss (&do_|
|000019d0| 66 74 70 5f 63 6d 64 28 | 22 28 32 33 30 7c 32 30 |ftp_cmd(|"(230|20|
|000019e0| 32 29 22 2c 20 22 70 61 | 73 73 20 24 50 61 73 73 |2)", "pa|ss $Pass|
|000019f0| 77 6f 72 64 22 29 29 20 | 7b 0d 09 24 66 74 70 5f |word")) |{..$ftp_|
|00001a00| 65 72 72 6f 72 20 2e 3d | 20 22 5c 6e 41 63 63 74 |error .=| "\nAcct|
|00001a10| 20 63 6f 6d 6d 61 6e 64 | 20 66 61 69 6c 65 64 20 | command| failed |
|00001a20| 65 73 74 61 62 6c 69 73 | 68 69 6e 67 20 63 6f 6e |establis|hing con|
|00001a30| 6e 65 63 74 69 6f 6e 20 | 74 6f 20 24 48 6f 73 74 |nection |to $Host|
|00001a40| 22 3b 0d 09 72 65 74 75 | 72 6e 20 75 6e 64 65 66 |";..retu|rn undef|
|00001a50| 3b 0d 20 20 20 20 7d 0d | 20 20 20 20 31 3b 0d 7d |;. }.| 1;.}|
|00001a60| 0d 0d 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |..######|########|
|00001a70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001a80| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001a90| 23 23 23 23 23 23 23 23 | 23 0d 0d 23 20 20 47 65 |########|#..# Ge|
|00001aa0| 74 20 6e 61 6d 65 20 6f | 66 20 63 75 72 72 65 6e |t name o|f curren|
|00001ab0| 74 20 72 65 6d 6f 74 65 | 20 64 69 72 65 63 74 6f |t remote| directo|
|00001ac0| 72 79 0d 0d 73 75 62 20 | 70 77 64 20 7b 20 23 23 |ry..sub |pwd { ##|
|00001ad0| 20 50 75 62 6c 69 63 0d | 20 20 20 20 69 66 20 28 | Public.| if (|
|00001ae0| 26 64 6f 5f 66 74 70 5f | 63 6d 64 28 32 35 37 2c |&do_ftp_|cmd(257,|
|00001af0| 20 22 70 77 64 22 29 29 | 20 7b 0d 09 24 66 74 70 | "pwd"))| {..$ftp|
|00001b00| 5f 6d 61 74 63 68 65 64 | 20 3d 7e 20 6d 2f 5e 32 |_matched| =~ m/^2|
|00001b10| 35 37 20 28 2e 2b 29 5c | 30 31 35 3f 5c 30 31 32 |57 (.+)\|015?\012|
|00001b20| 2f 3b 0d 09 24 31 3b 0d | 20 20 20 20 7d 20 65 6c |/;..$1;.| } el|
|00001b30| 73 65 20 7b 0d 09 75 6e | 64 65 66 3b 0d 20 20 20 |se {..un|def;. |
|00001b40| 20 7d 20 20 20 20 0d 7d | 0d 0d 23 23 23 23 23 23 | } .}|..######|
|00001b50| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001b60| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001b70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001b80| 23 0d 0d 23 20 20 52 65 | 6e 61 6d 65 20 61 20 72 |#..# Re|name a r|
|00001b90| 65 6d 6f 74 65 20 66 69 | 6c 65 0d 0d 73 75 62 20 |emote fi|le..sub |
|00001ba0| 72 65 6e 61 6d 65 20 7b | 20 23 23 20 50 75 62 6c |rename {| ## Publ|
|00001bb0| 69 63 0d 20 20 20 20 6c | 6f 63 61 6c 28 24 66 72 |ic. l|ocal($fr|
|00001bc0| 6f 6d 2c 20 24 74 6f 29 | 20 3d 20 40 5f 3b 0d 0d |om, $to)| = @_;..|
|00001bd0| 20 20 20 20 26 64 6f 5f | 66 74 70 5f 63 6d 64 28 | &do_|ftp_cmd(|
|00001be0| 33 35 30 2c 20 22 72 6e | 66 72 20 24 66 72 6f 6d |350, "rn|fr $from|
|00001bf0| 22 29 20 26 26 20 26 64 | 6f 5f 66 74 70 5f 63 6d |") && &d|o_ftp_cm|
|00001c00| 64 28 32 35 30 2c 20 22 | 72 6e 74 6f 20 24 74 6f |d(250, "|rnto $to|
|00001c10| 22 29 3b 0d 7d 0d 0d 23 | 23 23 23 23 23 23 23 23 |");.}..#|########|
|00001c20| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001c30| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001c40| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 0d 0d |########|######..|
|00001c50| 23 20 20 53 65 74 20 74 | 72 61 6e 73 66 65 72 20 |# Set t|ransfer |
|00001c60| 74 79 70 65 0d 0d 73 75 | 62 20 74 79 70 65 20 7b |type..su|b type {|
|00001c70| 20 23 23 20 50 75 62 6c | 69 63 0d 20 20 20 20 26 | ## Publ|ic. &|
|00001c80| 64 6f 5f 66 74 70 5f 63 | 6d 64 28 32 30 30 2c 20 |do_ftp_c|md(200, |
|00001c90| 22 74 79 70 65 22 2c 20 | 40 5f 29 3b 20 0d 7d 0d |"type", |@_); .}.|
|00001ca0| 0d 0d 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |..######|########|
|00001cb0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001cc0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001cd0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001ce0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 0d 23 0d |########|#####.#.|
|00001cf0| 23 20 20 54 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |# The f|ollowing|
|00001d00| 20 61 72 65 20 69 6e 74 | 65 6e 64 65 64 20 74 6f | are int|ended to|
|00001d10| 20 62 65 20 75 74 69 6c | 69 74 79 20 72 6f 75 74 | be util|ity rout|
|00001d20| 69 6e 65 73 20 75 73 65 | 64 20 6f 6e 6c 79 20 6c |ines use|d only l|
|00001d30| 6f 63 61 6c 6c 79 2e 0d | 23 20 20 55 73 65 72 73 |ocally..|# Users|
|00001d40| 20 73 68 6f 75 6c 64 20 | 6e 6f 74 20 63 61 6c 6c | should |not call|
|00001d50| 20 74 68 65 73 65 20 64 | 69 72 65 63 74 6c 79 2e | these d|irectly.|
|00001d60| 0d 23 0d 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |.#.#####|########|
|00001d70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d80| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d90| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001da0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 0d 0d |########|######..|
|00001db0| 73 75 62 20 64 6f 5f 66 | 74 70 5f 63 6d 64 20 7b |sub do_f|tp_cmd {|
|00001dc0| 20 20 23 23 20 50 72 69 | 76 61 74 65 0d 20 20 20 | ## Pri|vate. |
|00001dd0| 20 6c 6f 63 61 6c 28 24 | 6f 6b 61 79 2c 20 40 63 | local($|okay, @c|
|00001de0| 6f 6d 6d 61 6e 64 73 2c | 20 24 76 61 6c 29 20 3d |ommands,| $val) =|
|00001df0| 20 40 5f 3b 0d 0d 20 20 | 20 20 24 66 74 70 5f 65 | @_;.. | $ftp_e|
|00001e00| 63 68 6f 20 26 26 20 24 | 63 6f 6d 6d 61 6e 64 73 |cho && $|commands|
|00001e10| 5b 30 5d 20 26 26 20 0d | 09 70 72 69 6e 74 20 53 |[0] && .|.print S|
|00001e20| 54 44 45 52 52 20 6a 6f | 69 6e 28 22 20 22 2c 20 |TDERR jo|in(" ", |
|00001e30| 40 63 6f 6d 6d 61 6e 64 | 73 29 20 2e 20 22 5c 30 |@command|s) . "\0|
|00001e40| 31 35 5c 30 31 32 22 3b | 0d 20 20 20 20 24 63 6f |15\012";|. $co|
|00001e50| 6d 6d 61 6e 64 73 5b 30 | 5d 20 26 26 20 0d 09 26 |mmands[0|] && ..&|
|00001e60| 6d 61 63 63 68 61 74 27 | 70 72 69 6e 74 28 24 43 |macchat'|print($C|
|00001e70| 6f 6e 74 72 6f 6c 2c 20 | 28 6a 6f 69 6e 28 22 20 |ontrol, |(join(" |
|00001e80| 22 2c 20 40 63 6f 6d 6d | 61 6e 64 73 29 20 2e 20 |", @comm|ands) . |
|00001e90| 22 5c 30 31 35 5c 30 31 | 32 22 29 29 3b 0d 0d 20 |"\015\01|2"));.. |
|00001ea0| 20 20 20 26 6d 61 63 63 | 68 61 74 27 65 78 70 65 | &macc|hat'expe|
|00001eb0| 63 74 28 24 43 6f 6e 74 | 72 6f 6c 2c 20 36 30 2c |ct($Cont|rol, 60,|
|00001ec0| 20 0d 09 09 20 22 5e 24 | 6f 6b 61 79 20 2e 2a 5c | ... "^$|okay .*\|
|00001ed0| 5c 30 31 35 5c 5c 30 31 | 32 22 2c 20 20 20 20 27 |\015\\01|2", '|
|00001ee0| 70 72 69 6e 74 20 53 54 | 44 45 52 52 20 24 26 20 |print ST|DERR $& |
|00001ef0| 69 66 20 24 66 74 70 5f | 65 63 68 6f 3b 0d 20 20 |if $ftp_|echo;. |
|00001f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f10| 20 20 20 24 66 74 70 5f | 6d 61 74 63 68 65 64 20 | $ftp_|matched |
|00001f20| 3d 20 24 26 3b 20 31 27 | 2c 0d 09 09 20 22 5e 28 |= $&; 1'|,... "^(|
|00001f30| 5c 64 29 5c 64 5c 64 20 | 2e 2a 5c 5c 30 31 35 5c |\d)\d\d |.*\\015\|
|00001f40| 5c 30 31 32 22 2c 20 27 | 28 24 53 74 72 69 6e 67 |\012", '|($String|
|00001f50| 20 3d 20 24 26 29 20 3d | 7e 20 79 2f 5c 30 31 35 | = $&) =|~ y/\015|
|00001f60| 5c 30 31 32 2f 2f 64 3b | 0d 20 20 20 20 20 20 20 |\012//d;|. |
|00001f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 70 72 | | pr|
|00001f80| 69 6e 74 20 53 54 44 45 | 52 52 20 24 26 20 69 66 |int STDE|RR $& if|
|00001f90| 20 24 66 74 70 5f 65 63 | 68 6f 3b 0d 09 09 20 20 | $ftp_ec|ho;... |
|00001fa0| 20 20 20 24 66 74 70 5f | 65 72 72 6f 72 20 3d 20 | $ftp_|error = |
|00001fb0| 71 71 7b 55 6e 65 78 70 | 65 63 74 65 64 20 72 65 |qq{Unexp|ected re|
|00001fc0| 70 6c 79 20 66 6f 72 20 | 27 20 2e 0d 09 09 20 20 |ply for |' .... |
|00001fd0| 20 20 20 22 40 63 6f 6d | 6d 61 6e 64 73 22 20 2e | "@com|mands" .|
|00001fe0| 20 27 3a 20 24 53 74 72 | 69 6e 67 7d 3b 20 0d 09 | ': $Str|ing}; ..|
|00001ff0| 09 20 20 20 20 20 24 31 | 20 3e 20 33 20 3f 20 75 |. $1| > 3 ? u|
|00002000| 6e 64 65 66 20 3a 20 31 | 27 2c 0d 09 09 20 40 73 |ndef : 1|',... @s|
|00002010| 74 64 5f 61 63 74 69 6f | 6e 73 0d 09 09 29 3b 0d |td_actio|ns...);.|
|00002020| 7d 0d 0d 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |}..#####|########|
|00002030| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002040| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002050| 23 23 23 23 23 23 23 23 | 23 23 0d 0d 73 75 62 20 |########|##..sub |
|00002060| 64 6f 5f 66 74 70 5f 6c | 69 73 74 69 6e 67 20 7b |do_ftp_l|isting {|
|00002070| 20 23 23 20 50 72 69 76 | 61 74 65 0d 20 20 20 20 | ## Priv|ate. |
|00002080| 6c 6f 63 61 6c 28 40 6c | 63 6d 64 29 20 3d 20 40 |local(@l|cmd) = @|
|00002090| 5f 3b 0d 20 20 20 20 40 | 66 74 70 5f 6c 69 73 74 |_;. @|ftp_list|
|000020a0| 20 3d 20 28 29 3b 0d 20 | 20 20 20 24 66 74 70 5f | = ();. | $ftp_|
|000020b0| 74 72 61 6e 73 5f 66 6c | 61 67 20 3d 20 30 3b 0d |trans_fl|ag = 0;.|
|000020c0| 0d 20 20 20 20 72 65 74 | 75 72 6e 20 75 6e 64 65 |. ret|urn unde|
|000020d0| 66 20 75 6e 6c 65 73 73 | 20 26 64 6f 5f 6f 70 65 |f unless| &do_ope|
|000020e0| 6e 5f 64 70 6f 72 74 3b | 0d 0d 20 20 20 20 72 65 |n_dport;|.. re|
|000020f0| 74 75 72 6e 20 75 6e 64 | 65 66 20 75 6e 6c 65 73 |turn und|ef unles|
|00002100| 73 20 26 64 6f 5f 66 74 | 70 5f 63 6d 64 28 31 35 |s &do_ft|p_cmd(15|
|00002110| 30 2c 20 40 6c 63 6d 64 | 29 3b 0d 20 20 20 20 64 |0, @lcmd|);. d|
|00002120| 6f 20 7b 09 09 09 23 20 | 20 46 6f 6c 6c 6f 77 69 |o {...# | Followi|
|00002130| 6e 67 20 69 73 20 67 72 | 6f 74 74 79 2c 20 62 75 |ng is gr|otty, bu|
|00002140| 74 20 6d 61 63 63 68 61 | 74 32 20 6d 61 6b 65 73 |t maccha|t2 makes|
|00002150| 20 75 73 20 64 6f 20 69 | 74 0d 20 20 20 20 20 20 | us do i|t. |
|00002160| 20 20 26 6d 61 63 63 68 | 61 74 27 65 78 70 65 63 | &macch|at'expec|
|00002170| 74 28 24 44 61 74 61 5f | 68 61 6e 64 6c 65 2c 20 |t($Data_|handle, |
|00002180| 33 30 2c 0d 09 09 27 28 | 2e 2a 5c 6e 3f 5c 30 31 |30,...'(|.*\n?\01|
|00002190| 32 29 27 2c 20 20 20 20 | 27 70 75 73 68 28 40 66 |2)', |'push(@f|
|000021a0| 74 70 5f 6c 69 73 74 2c | 20 24 31 29 27 2c 0d 09 |tp_list,| $1)',..|
|000021b0| 09 22 45 4f 46 22 2c 20 | 20 20 20 20 27 24 66 74 |."EOF", | '$ft|
|000021c0| 70 5f 74 72 61 6e 73 5f | 66 6c 61 67 20 3d 20 31 |p_trans_|flag = 1|
|000021d0| 27 29 3b 0d 20 20 20 20 | 7d 20 75 6e 74 69 6c 20 |');. |} until |
|000021e0| 24 66 74 70 5f 74 72 61 | 6e 73 5f 66 6c 61 67 3b |$ftp_tra|ns_flag;|
|000021f0| 0d 0d 20 20 20 20 26 6d | 61 63 63 68 61 74 27 63 |.. &m|acchat'c|
|00002200| 6c 6f 73 65 28 24 44 61 | 74 61 5f 68 61 6e 64 6c |lose($Da|ta_handl|
|00002210| 65 29 3b 0d 20 20 20 20 | 72 65 74 75 72 6e 20 75 |e);. |return u|
|00002220| 6e 64 65 66 20 75 6e 6c | 65 73 73 20 26 64 6f 5f |ndef unl|ess &do_|
|00002230| 66 74 70 5f 63 6d 64 28 | 32 32 36 29 3b 0d 0d 20 |ftp_cmd(|226);.. |
|00002240| 20 20 20 67 72 65 70 28 | 79 2f 5c 30 31 35 5c 30 | grep(|y/\015\0|
|00002250| 31 32 2f 2f 64 2c 20 40 | 66 74 70 5f 6c 69 73 74 |12//d, @|ftp_list|
|00002260| 29 3b 0d 20 20 20 20 40 | 66 74 70 5f 6c 69 73 74 |);. @|ftp_list|
|00002270| 3b 0d 7d 20 20 0d 0d 23 | 23 23 23 23 23 23 23 23 |;.} ..#|########|
|00002280| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002290| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000022a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 0d 0d |########|######..|
|000022b0| 73 75 62 20 64 6f 5f 6f | 70 65 6e 5f 64 70 6f 72 |sub do_o|pen_dpor|
|000022c0| 74 20 7b 20 23 23 20 50 | 72 69 76 61 74 65 0d 20 |t { ## P|rivate. |
|000022d0| 20 20 20 6c 6f 63 61 6c | 28 40 66 6f 6f 2c 20 24 | local|(@foo, $|
|000022e0| 66 61 6d 2c 20 24 61 64 | 64 72 2c 20 24 70 6f 72 |fam, $ad|dr, $por|
|000022f0| 74 29 20 3d 20 26 6d 61 | 63 63 68 61 74 27 6f 70 |t) = &ma|cchat'op|
|00002300| 65 6e 5f 6c 69 73 74 65 | 6e 28 26 47 55 53 49 27 |en_liste|n(&GUSI'|
|00002310| 41 46 5f 49 4e 45 54 29 | 3b 0d 20 20 20 20 28 24 |AF_INET)|;. ($|
|00002320| 70 6f 72 74 2c 20 24 44 | 61 74 61 5f 68 61 6e 64 |port, $D|ata_hand|
|00002330| 6c 65 29 20 3d 20 40 66 | 6f 6f 3b 0d 20 20 20 20 |le) = @f|oo;. |
|00002340| 28 24 66 61 6d 2c 24 61 | 64 64 72 2c 24 70 6f 72 |($fam,$a|ddr,$por|
|00002350| 74 29 20 3d 20 26 47 55 | 53 49 27 75 6e 70 61 63 |t) = &GU|SI'unpac|
|00002360| 6b 5f 73 6f 63 6b 61 64 | 64 72 5f 69 6e 28 24 70 |k_sockad|dr_in($p|
|00002370| 6f 72 74 29 3b 0d 0d 20 | 20 20 20 75 6e 6c 65 73 |ort);.. | unles|
|00002380| 73 20 28 24 44 61 74 61 | 5f 68 61 6e 64 6c 65 29 |s ($Data|_handle)|
|00002390| 20 7b 0d 09 24 66 74 70 | 5f 65 72 72 6f 72 20 3d | {..$ftp|_error =|
|000023a0| 20 20 22 55 6e 61 62 6c | 65 20 74 6f 20 6f 70 65 | "Unabl|e to ope|
|000023b0| 6e 20 64 61 74 61 20 70 | 6f 72 74 3a 20 24 21 22 |n data p|ort: $!"|
|000023c0| 3b 0d 09 72 65 74 75 72 | 6e 20 75 6e 64 65 66 3b |;..retur|n undef;|
|000023d0| 0d 20 20 20 20 7d 0d 0d | 20 20 20 20 24 61 64 64 |. }..| $add|
|000023e0| 72 20 3d 7e 20 74 72 2f | 2e 2f 2c 2f 3b 0d 20 20 |r =~ tr/|./,/;. |
|000023f0| 20 20 40 66 6f 6f 20 3d | 20 28 24 70 6f 72 74 20 | @foo =| ($port |
|00002400| 3e 3e 20 38 2c 20 24 70 | 6f 72 74 20 26 20 30 78 |>> 8, $p|ort & 0x|
|00002410| 66 66 29 3b 0d 20 20 20 | 20 24 61 64 64 72 20 2e |ff);. | $addr .|
|00002420| 3d 20 22 2c 22 20 2e 20 | 6a 6f 69 6e 28 27 2c 27 |= "," . |join(','|
|00002430| 2c 20 40 66 6f 6f 29 3b | 0d 20 20 20 20 0d 20 20 |, @foo);|. . |
|00002440| 20 20 26 64 6f 5f 66 74 | 70 5f 63 6d 64 28 32 30 | &do_ft|p_cmd(20|
|00002450| 30 2c 20 22 70 6f 72 74 | 20 24 61 64 64 72 22 29 |0, "port| $addr")|
|00002460| 3b 0d 7d 0d 0d 23 23 23 | 23 23 23 23 23 23 23 23 |;.}..###|########|
|00002470| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002480| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002490| 23 23 23 23 23 23 23 23 | 23 23 23 23 0d 23 0d 23 |########|####.#.#|
|000024a0| 20 20 54 6f 20 63 6c 65 | 61 6e 75 70 20 61 66 74 | To cle|anup aft|
|000024b0| 65 72 20 61 20 70 72 6f | 62 6c 65 6d 0d 23 0d 0d |er a pro|blem.#..|
|000024c0| 73 75 62 20 64 6f 5f 66 | 74 70 5f 61 62 6f 72 74 |sub do_f|tp_abort|
|000024d0| 20 7b 0d 20 20 20 20 64 | 69 65 20 75 6e 6c 65 73 | {. d|ie unles|
|000024e0| 73 20 24 4e 65 65 64 73 | 43 6c 6f 73 65 3b 0d 0d |s $Needs|Close;..|
|000024f0| 20 20 20 20 26 6d 61 63 | 63 68 61 74 27 70 72 69 | &mac|chat'pri|
|00002500| 6e 74 28 24 43 6f 6e 74 | 72 6f 6c 2c 20 22 61 62 |nt($Cont|rol, "ab|
|00002510| 6f 72 22 2c 20 22 5c 30 | 31 35 5c 30 31 32 22 29 |or", "\0|15\012")|
|00002520| 3b 0d 20 20 20 20 26 6d | 61 63 63 68 61 74 27 63 |;. &m|acchat'c|
|00002530| 6c 6f 73 65 28 24 44 61 | 74 61 5f 68 61 6e 64 6c |lose($Da|ta_handl|
|00002540| 65 29 3b 0d 20 20 20 20 | 26 6d 61 63 63 68 61 74 |e);. |&macchat|
|00002550| 27 65 78 70 65 63 74 28 | 24 43 6f 6e 74 72 6f 6c |'expect(|$Control|
|00002560| 2c 20 31 30 2c 20 27 2e | 27 2c 20 75 6e 64 65 66 |, 10, '.|', undef|
|00002570| 29 3b 0d 20 20 20 20 26 | 6d 61 63 63 68 61 74 27 |);. &|macchat'|
|00002580| 63 6c 6f 73 65 28 24 43 | 6f 6e 74 72 6f 6c 29 3b |close($C|ontrol);|
|00002590| 0d 0d 20 20 20 20 63 6c | 6f 73 65 20 44 46 49 4c |.. cl|ose DFIL|
|000025a0| 45 3b 0d 20 20 20 20 75 | 6e 6c 69 6e 6b 28 24 4e |E;. u|nlink($N|
|000025b0| 65 65 64 73 43 6c 65 61 | 6e 75 70 29 20 69 66 20 |eedsClea|nup) if |
|000025c0| 24 4e 65 65 64 73 43 6c | 65 61 6e 75 70 3b 0d 20 |$NeedsCl|eanup;. |
|000025d0| 20 20 20 64 69 65 3b 0d | 7d 0d 0d 23 23 23 23 23 | die;.|}..#####|
|000025e0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000025f0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002600| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002610| 23 23 0d 23 0d 23 20 20 | 54 6f 20 73 65 74 20 73 |##.#.# |To set s|
|00002620| 69 67 6e 61 6c 73 20 74 | 6f 20 64 6f 20 74 68 65 |ignals t|o do the|
|00002630| 20 61 62 6f 72 74 20 70 | 72 6f 70 65 72 6c 79 0d | abort p|roperly.|
|00002640| 23 0d 0d 73 75 62 20 64 | 6f 5f 66 74 70 5f 73 69 |#..sub d|o_ftp_si|
|00002650| 67 6e 61 6c 73 20 7b 0d | 20 20 20 20 6c 6f 63 61 |gnals {.| loca|
|00002660| 6c 28 24 66 6c 61 67 2c | 20 24 73 69 67 29 20 3d |l($flag,| $sig) =|
|00002670| 20 40 5f 3b 0d 0d 20 20 | 20 20 6c 6f 63 61 6c 20 | @_;.. | local |
|00002680| 28 24 6f 6c 64 2c 20 24 | 6e 65 77 29 20 3d 20 28 |($old, $|new) = (|
|00002690| 27 44 45 46 41 55 4c 54 | 27 2c 20 22 66 74 70 27 |'DEFAULT|', "ftp'|
|000026a0| 64 6f 5f 66 74 70 5f 61 | 62 6f 72 74 22 29 3b 0d |do_ftp_a|bort");.|
|000026b0| 20 20 20 20 24 66 6c 61 | 67 20 7c 7c 20 28 28 24 | $fla|g || (($|
|000026c0| 6f 6c 64 2c 20 24 6e 65 | 77 29 20 3d 20 28 24 6e |old, $ne|w) = ($n|
|000026d0| 65 77 2c 20 24 6f 6c 64 | 29 29 3b 0d 20 20 20 20 |ew, $old|));. |
|000026e0| 66 6f 72 65 61 63 68 20 | 24 73 69 67 20 28 40 73 |foreach |$sig (@s|
|000026f0| 69 67 73 29 20 7b 0d 09 | 28 24 53 49 47 7b 24 73 |igs) {..|($SIG{$s|
|00002700| 69 67 7d 20 3d 3d 20 24 | 6f 6c 64 29 20 26 26 20 |ig} == $|old) && |
|00002710| 28 24 53 49 47 7b 24 73 | 69 67 7d 20 3d 20 24 6e |($SIG{$s|ig} = $n|
|00002720| 65 77 29 3b 0d 20 20 20 | 20 7d 0d 7d 0d 0d 31 3b |ew);. | }.}..1;|
|00002730| 0d 0d 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002780| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00002790| aa 20 34 2e 30 20 2d 20 | 64 69 73 6b 20 31 00 00 |. 4.0 - |disk 1..|
|000027a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027b0| 09 6d 61 63 66 74 70 2e | 70 6c 02 00 00 00 54 45 |.macftp.|pl....TE|
|000027c0| 58 54 4d 50 53 20 01 00 | 01 04 00 50 00 00 00 00 |XTMPS ..|...P....|
|000027d0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 01 04 00 50 |..TEXTMP|S .....P|
|000027e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027f0| 00 00 a8 ee 28 f4 00 00 | 26 b2 00 00 01 ac 00 a6 |....(...|&.......|
|00002800| 00 02 00 01 0d 44 65 76 | 2e 43 44 20 4f 63 74 20 |.....Dev|.CD Oct |
|00002810| 39 33 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |93......|........|
|00002820| a8 a1 4b 01 42 44 00 05 | 00 00 00 01 0d 44 65 76 |..K.BD..|.....Dev|
|00002830| 2e 43 44 20 4f 63 74 20 | 39 33 00 00 00 00 00 00 |.CD Oct |93......|
|00002840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 02 |........|........|
|00002870| a8 a1 4b 47 00 27 00 01 | 01 26 01 5f ff ff ff ff |..KG.'..|.&._....|
|00002880| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00002890| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028a0| 00 00 00 00 00 00 00 06 | 00 03 00 64 00 1c 01 dd |........|...d....|
|000028b0| 02 3d 00 64 00 1c 01 dd | 02 3d a8 ee 28 f6 00 00 |.=.d....|.=..(...|
|000028c0| 00 00 00 00 00 00 00 00 | 15 04 01 00 00 00 00 1e |........|........|
|000028d0| 00 64 00 1c 01 dd 02 3d | 00 64 00 1c 01 dd 02 3d |.d.....=|.d.....=|
|000028e0| 00 00 15 04 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 2d |.....n..|.n...>.-|
|00002900| f5 f4 15 4e 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |...N....|.>..MPSR|
|00002910| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00002920| 03 f0 ff ff 00 00 00 4c | 00 30 4d 18 00 00 00 00 |.......L|.0M.....|
|00002930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+